<?php
/*
Template Name: Add New Request
*/
/**
 * QAPRC This is the template for displaying .......
 * It includes all the basic elements for 
 *
 * @package Prospress
 * @subpackage Theme
 * @since 0.1
 */

					//QAPRC upon submission create new post
					// Create post object
					if (isset($_POST['submit'])) { 
						$new_post = array(
						'post_title' => 'New Request',
						'post_content' => 'just another request',
						'post_status' => 'publish',
						'post_type' => 'auctions',
						);     

						//insert the post
						$post_id = wp_insert_post( $new_post );
					
						//add the post-meta(custom fields)  
						update_post_meta( $post_id, 'attest_cat', $_POST[ 'attest_cat' ] );
						update_post_meta( $post_id, 'CorpForm', $_POST[ 'CorpForm' ] );
						update_post_meta( $post_id, 'numOriginals', $_POST[ 'numOriginals' ] );   
						update_post_meta( $post_id, 'numCopies', $_POST[ 'numCopies' ] );
						update_post_meta( $post_id, 'attestPurpose', $_POST[ 'attestPurpose' ] );
						update_post_meta( $post_id, 'CorpForm', $_POST[ 'CorpForm' ] );
						update_post_meta( $post_id, 'numDirectors', $_POST[ 'numDirectors' ] );
						update_post_meta( $post_id, 'numCorpDirectors', $_POST[ 'numCorpDirectors' ] );
						update_post_meta( $post_id, 'numChangeName', $_POST[ 'numChangeName' ] );
						update_post_meta( $post_id, 'rePriority', $_POST[ 'rePriority' ] );
					echo  "form submitted successfully";
					}?>
					
<?php get_header(); ?>
        <div id="addRequest_content">
            <div id="addRequest_wrapper">
				<div id="addRequest_navigation" style="display:none;">
                    <ul>
						<li class="selected">
                            <a href="#"><?php _e('Part One', 'prospress'); ?></a>
                        </li>
						<li> 
                            <a href="#">Part Two</a>
                        </li>
                        <li>
                            <a href="#">Confirm</a>
                        </li>                    
                    </ul>
                </div>
				
				<div id="steps">
                    <form id="formElem" name="formElem" action="" method="post";>
                        <fieldset class="step">
                            <legend>The Attestation</legend>
                            <p>
                                <label for="attest_cat">Category</label>
                                <select id="attest_cat" name="attest_cat">
                                    <option value="Corporate's Current Status">Corporate's Current Status</option>
                                    <option value="Authorization Letter or Power of Attorney">Authorization Letter or Power of Attorney</option>
                                    <option value="Declaration">Declaration</option>
                                    <option value="Sole Director Resolution">Sole Director Resolution</option>       
                                    <option value="Certified Original/ Original True Copy">Certified Original/ Original True Copy</option>
                                    <option value="Appointment/ Dismissal Letter">Appointment/ Dismissal Letter</option>                                     
                                </select>
                            </p>
                            <p>
                               	<label for="numOriginals">How many set of ORIGINALS are required for each document?</label>
                                <input id="numOriginals" name="numOriginals" type="number" min="1" max="5" value="" style="width:45px;" AUTOCOMPLETE=OFF />
                            </p>                      
                            <p>
                               	<label for="numCopies"> How many set of COPIES are required for each document?</label>
                                <input id="numCopies" name="numCopies" type="number" min="1" max="5" value="" style="width:45px;" AUTOCOMPLETE=OFF />
                            </p>
							
			
							<p> 
                            	<label for="attestPurpose">What is the purpose for the attestation?</label>
                            	<select id="attestPurpose" name="attestPurpose">
                            	    <option value="" selected="selected">make a choice</option>
                                    <option value="employment"> Employmnent</option>
                                    <option value="litigation"> Litigation</option>
                                    <option value="tendering"> Participating a Tender</option>       
								</select>
                            </p>

                        </fieldset>					
                        <fieldset class="step">
                            <legend>The Company</legend>
							<p class="radioOptions">
								<label for="CorpForm">The company is registered in Hong Kong as:</label><br>
								<input type="radio" id="CorpForm" name="CorpForm" value="Limited Co" checked />Limited Company<br />
								<input type="radio" id="CorpForm" name="CorpForm" value="Unlimited Company" />Unlimied Company<br />
								<input type="radio" id="CorpForm" name="CorpForm" value="Overseas Company" />Overseas Company<br />
								<input type="radio" id="CorpForm" name="CorpForm" value="Not Registered in Hong Kong" />Branch Office<br />
							</p>
                            <p>
                                <label for="numDirectors">Number of Director(s)?</label>
                                <input id="numDirectors" name="numDirectors" type="number" min="1" max="10" value ="" style="width:45px;"/>
                            </p>
							<p>
                                <label for="numCorpDirectors">Number of Corporate Director, if any?</label>
                                <input id="numCorpDirectors" name="numCorpDirectors" type="number" min="0" max="10" value ="" style="width:45px;"/>
                            </p>
							<p>
                                <label for="numChangeName">How many times has the company changed its name?</label>
								<input id="numChangeName" name="numChangeName" type="number" min="0" max="10" value ="" style="width:45px;"/>
							</p>
                        </fieldset>
						<fieldset class="step">
                            <legend>Confirm</legend>
							<p class="radioOptions">
								<label for="rePriority">Would you make it a prioritized request?</label><br>
								<input type="radio" id="rePriority" name="rePriority" value="prioritized" checked />prioritized<br>
								<input type="radio" id="rePriority" name="rePriority" value="standard" />standard<br>
								<!--Prioritized? If so, pick dueDate -->
							</p>
							<script> 
								  $(document).ready(function() {
									$("#datepicker").datepicker();
								  });
							</script>
							<p>
								<label for="dueDate">Date</label>
								<input type="text" id="datepicker">
							</p>                   
							<p>
								Everything in the form was correctly filled 
								if all the steps have a green checkmark icon.
								A red checkmark icon indicates that some field 
								is missing or filled out with invalid data. In this
								last step the user can confirm the submission of
								the form.
							</p>
                            <p class="submit">
								<input id="registerButton" name="submit" type="submit" value="true"/>
                            </p>              
						</fieldset>
                    </form>				      		
                </div>                
            </div>
        </div>

<?php get_footer(); ?>	